package Leetcode;

import java.util.Stack;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class maxArea {
    public int maxArea(int[] height) {
        int i = 0;
        int j = height.length - 1;
        int result = 0;
        while (i < j){
            int w = j - i;
            int h = 0;
            if (height[i] < height[j]){
                h = height[i];
                i++;
            } else {
                h = height[j];
                j--;
            }
            result = Math.max(result, h * w);
        }
        return result;
    }
}
